<template>
	<view>
		<myhead txt="银行列表"></myhead>
		<!-- <navigator v-for="(item,index) in list" :key="index" :url="'../bank/'+item.bankType+'/'+item.bankType+'?id='+item.id" hover-class="navigator-hover" class="list">
			<view>{{item.bankName}}</view>
			<view class="sjBtn" @tap="deployBtn" :data-id="item.id">+添加数据</view>
		</navigator> -->
		<view class="list" v-for="(item,index) in list" :key="index" @tap="listBtn" :data-url="item.bankType" :data-id="item.id">
			<view>{{item.bankName}}</view>
			<view class="sjBtn" @tap.stop="deployBtn" :data-id="item.id">+添加数据</view>
		</view>
		<!-- <navigator url="1003" hover-class="navigator-hover" class="list">
			<view>建设银行</view>
			<view>+添加数据</view>
		</navigator>
		<navigator url="assets" hover-class="navigator-hover" class="list">
			<view>农业银行</view>
			<view>+添加数据</view>
		</navigator> -->
		<view class="btn" @tap="btn">+添加银行卡</view>
	</view>
</template>

<script>
	const http = require('../../utils/http.js');
	export default {
		data() {
			return {
				list:null
			}
		},
		onLoad(options) {
			
		},
		onShow() {
			uni.showLoading({
			    title: '加载中'
			});
			http.get('/api/balance/getBalance').then(res => {
				//console.log(res)
				if (res.code == 200 && res.result) {
					this.list=res.result
				}
				uni.hideLoading();
			})
		},
		methods: {
			btn:function(){
				uni.navigateTo({
					url:'/pages/bank/deployBank'
				})
			},
			deployBtn:function(e){
				console.log('123')
				uni.navigateTo({
					url:'/pages/user/deploy?id=' + e.currentTarget.dataset.id
				})
			},
			listBtn:function(e){
				console.log('asd')
				var item = e.currentTarget.dataset
				//console.log('/pages/bank/'+item.url+'/'+item.url+'?id=' + item.id)
				uni.navigateTo({
					url:'/pages/bank/'+item.url+'/'+item.url+'?id=' + item.id
				})
			}
		}
	}
</script>

<style>
	.list{
		width: 95%;
		padding: 0 3vw;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1px solid #f2f2f2;
		color: #333333;
	}
	.sjBtn{
		padding: 3vw;
		z-index: 999;
	}
	.btn{
		width: 84%;
		padding: 4vw 0;
		font-size: 3.5vw;
		border-radius: 1.8vw;
		background-image: linear-gradient(45deg, #24EBA9, #10C7B2);
		color: #FFFFFF;
		text-align: center;
		margin: 0 auto;
		margin-top: 10vw;
	}
</style>
